package com.chen.controller;

import com.chen.bean.Label;
import com.chen.bean.Result;
import com.chen.service.LabelService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/label")
public class LabelController {

    @Resource
    LabelService labelService;

    @GetMapping("/loadList")
    public Result loadLabelList(){
        try {
            List<Label> labelList = labelService.getLabelList();
            return Result.success(labelList);
        }catch (Exception e){
            e.printStackTrace();
            return Result.error(1,"出错了",null);
        }
    }
}
